# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=runit
pkgver=2.1.2
pkgrel=5
pkgdesc="UNIX init scheme with service supervision"
url="http://smarden.org/runit/"
arch="all"
license="BSD"
subpackages="$pkgname-doc $pkgname-openrc"
source="http://smarden.org/runit/runit-$pkgver.tar.gz
	run-service-dir.patch
	svlogd-udp.patch
	README.alpine
	$pkgname.initd
	"
builddir="$srcdir/admin/runit-$pkgver/src"

build() {
	make
}

package() {
	install -d "$pkgdir"/sbin
	for i in chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset; do
		install -m755 "$i" "$pkgdir"/sbin/$i
	done
	install -d "$pkgdir"/usr/share/man/man8
	cd .. && cp -rf man/* "$pkgdir"/usr/share/man/man8/
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/runitd
	install -Dm644 "$srcdir"/README.alpine -t "$pkgdir"/usr/share/doc/$pkgname
	mkdir -p "$pkgdir"/etc/service
	mkdir -p "$pkgdir"/etc/sv
}

sha512sums="a18773ebf1aa22305dd89ed67363165b9fcf86c192b2be4e268d08005dd82d51265160c637abe072f2f2e378c4b315a75bd3d3e602c3e75bdd451a3b0190f8cf  runit-2.1.2.tar.gz
7107da162f7c13e1483f17bf04a844c23a8d1b81ef982c3d956a4c0e23b2a20e415850f0b95999b1eb1e04638284884948937377756ca080037bd6455e3301e8  run-service-dir.patch
c88dadaefaddab4fa6e32ff26e2106331e8da83eeaf2e6bc63e1dcf4f644eb4134a6e07ea7789e6101c4a13dbd655ba5ef05df6d9d020fab5da973aee204b0b4  svlogd-udp.patch
88d1efcf366add7803ed026ec8e693b271c842d4e3d5a52587b7ead96266ee27b4ceb1b2696551243f0d9efa93199a07231d2b37186ce1535e9a6b9d90192909  README.alpine
a3e82785650dbb0a96454ae29635012022bd3a705318bdb56a4430a2f487f4aa17661fb1a87fce56ca535b6a526a618a7673ad66848d5fffb47f5795cdcbf18b  runit.initd"
